import React from "react";

export default class Sub extends React.Component{
  constructor(props){
    super(props);
    this.state = {num :0};
    this.handle = this.handle.bind(this);
  }
  handle(){
    ++this.state.num;
    if(this.state.num%5==0){
      this.props.onFive(this.state.num);
    }
  }
  render(){
    return <div>
      <button onClick={this.handle}>click me!</button>
    </div>
  }
}
